package main

import (
	"fmt"

	"time"

	"github.com/golang-module/carbon"
)

//https://gitee.com/go-package/carbon
func main() {
	//获取当前时间
	timeStr := carbon.Now().ToDateTimeString()
	fmt.Println(timeStr)

	nowDateTime, _ := time.Parse("2006-01-02", timeStr)
	nowDate := nowDateTime.Format("20060102")
	fmt.Println(nowDate)

	//获取前一天时间
	// var nowDate string
	// nowDate = "2021-11-03"
	// for i := 0; i <= 10; i++ {
	// 	subDay := carbon.Parse(nowDate).SubDay().ToDateString()
	// 	fmt.Println(subDay)
	// 	nowDate = subDay
	// }

}
